package com.example.stray_animal_management_system.util;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * @description: 救助id生成
 * @author: panpan
 * @time: 2025/10/26
 */
public class CodeGeneratorUtil {
    private static final AtomicInteger COUNTER = new AtomicInteger(1);

    public static String generateRescueCode() {
        // 格式：RSC20251026001
        String date = new SimpleDateFormat("yyyyMMdd").format(new Date());
        int count = COUNTER.getAndIncrement();
        return String.format("RSC%s%03d", date, count);
    }
}